<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>arr</title>
   <script type="text/javascript">
   //取出最大的值
   // var arr=[1,156,23,6,43,87,3,5,55];
   // function  max (arr) {
   // 	   var max=arr[0]
   // 	for(var i in arr){

   // 		if(arr[i]>max){

   // 			max=arr[i];
   // 		}
   // 	}
   // 	return max;
   // }
   // var res=max(arr);
   // alert(res);
//取出最大长度的值
var arr=[1,56,[23,6,43,87],6,[23,6,43,87,67],87,3,5,55];

function long(arr){
	  var xiabiao=0;
	  var  alength=0;

	for(var i in arr){

		if(typeof(arr[i])=='object'){

			if(arr[i].length>alength){
				alength=arr[i].length;
				xiabiao=i;
			   }
        	}
		
	   }
	 return [xiabiao,alength];
   }
var res =long(arr);
 alert(arr[res[0]]);
 alert(res[1]);

   </script>
</head>
<body>
	
</body>
</html>